/***************************************************************************
 *   Copyright (C) 2007 by Alexandre Masselot,,,   *
 *   alex@alex-laptop   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef BOLSPECTRUMPEAKREFITERATOR_H
#define BOLSPECTRUMPEAKREFITERATOR_H

#include "spectrumpeakref.h"
#include <vector>

namespace bol {
  using namespace std;

/**
  a pointer towards a peak inside a spectrum based on iterators.
  @author Alexandre Masselot,GeneBio,http://www.genebio.com, <alexandre.masselot@gmail.com>
 */
//@TODO add certainly something like a pointer back to itSpectrum's vector begin and and
//@TODO add a mechanism to get all peak in a certain range (or may it should be done at the implementation layer...)

  
  template<class PeakClass> class SpectrumPeakRefIterator: public SpectrumPeakRef<PeakClass>{
    private:
      const Spectrum<PeakClass * >::iterator  __itIndex;
      const vector< Spectrum<PeakClass* > * >::iterator  __itSpectrum;
    public:
      SpectrumPeakRefIterator<PeakClass>(const vector<Spectrum<PeakClass*>*>::const_iterator itSpectrum, const vector<PeakClass*>::const_iterator itIndex):__itSpectrum(itSpectrum),__itIndex(itIndex){
      };

      ~SpectrumPeakRefIterator(){}

      const Spectrum<PeakClass*>* spectrum()const {
        return *__itIndex;
      }
      virtual const PeakClass* peak()const {
        return *__itSpectrum;
      }

  };
}

#endif
